package com.cms.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.cms.entity.Files;
import org.apache.ibatis.annotations.*;

import java.io.File;

@Mapper
public interface FileMapper extends BaseMapper<Files> {
/*
    @Select("SELECT * FROM files")
    List<File> selectAll();

    @Select("SELECT * FROM files WHERE id = #{id}")
    File selectById(Integer id);

    @Insert("INSERT INTO files(name, type, size, url, md5, is_delete, enable) " +
            "VALUES(#{name}, #{type}, #{size}, #{url}, #{md5}, #{isDelete}, #{enable})")
    @Options(useGeneratedKeys = true, keyProperty = "id")
    int insert(File file);

    @Update("UPDATE files SET name = #{name}, type = #{type}, size = #{size}, url = #{url}, md5 = #{md5}, " +
            "is_delete = #{isDelete}, enable = #{enable} WHERE id = #{id}")
    int update(File file);

    @Delete("DELETE FROM files WHERE id = #{id}")
    int deleteById(Integer id);

    @Select("SELECT * FROM files WHERE is_delete = false")
    List<File> selectNotDeleted();

    @Update("UPDATE files SET is_delete = true WHERE id = #{id}")
    int softDeleteById(Integer id);
    */

}
